home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 1_2002.ISO / Data / Zips / Query View258019220.psc / DbMagic3.0 / main.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  2001-09-02  |  10.3 KB  |  330 lines

  1. VERSION 5.00
  2. Object = "{0ECD9B60-23AA-11D0-B351-00A0C9055D8E}#6.0#0"; "MSHFLXGD.OCX"
  3. Begin VB.Form Form1 
  4.    Caption         =   "Query Viewer - Ver 3.0 - www.cispl.com"
  5.    ClientHeight    =   8340
  6.    ClientLeft      =   60
  7.    ClientTop       =   1695
  8.    ClientWidth     =   11880
  9.    Icon            =   "main.frx":0000
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   8340
  12.    ScaleWidth      =   11880
  13.    StartUpPosition =   2  'CenterScreen
  14.    WindowState     =   2  'Maximized
  15.    Begin VB.Frame Frame4 
  16.       Caption         =   "Table Information"
  17.       Height          =   2295
  18.       Left            =   9000
  19.       TabIndex        =   11
  20.       Top             =   4560
  21.       Width           =   2775
  22.       Begin VB.Label Label6 
  23.          AutoSize        =   -1  'True
  24.          BeginProperty Font 
  25.             Name            =   "Verdana"
  26.             Size            =   8.25
  27.             Charset         =   0
  28.             Weight          =   700
  29.             Underline       =   0   'False
  30.             Italic          =   0   'False
  31.             Strikethrough   =   0   'False
  32.          EndProperty
  33.          Height          =   195
  34.          Left            =   1560
  35.          TabIndex        =   16
  36.          Top             =   1440
  37.          Width           =   60
  38.       End
  39.       Begin VB.Label Label5 
  40.          AutoSize        =   -1  'True
  41.          BeginProperty Font 
  42.             Name            =   "Verdana"
  43.             Size            =   8.25
  44.             Charset         =   0
  45.             Weight          =   700
  46.             Underline       =   0   'False
  47.             Italic          =   0   'False
  48.             Strikethrough   =   0   'False
  49.          EndProperty
  50.          Height          =   195
  51.          Left            =   1560
  52.          TabIndex        =   15
  53.          Top             =   960
  54.          Width           =   60
  55.       End
  56.       Begin VB.Label Label4 
  57.          AutoSize        =   -1  'True
  58.          Caption         =   "Total Fields :"
  59.          BeginProperty Font 
  60.             Name            =   "Verdana"
  61.             Size            =   8.25
  62.             Charset         =   0
  63.             Weight          =   400
  64.             Underline       =   0   'False
  65.             Italic          =   0   'False
  66.             Strikethrough   =   0   'False
  67.          EndProperty
  68.          Height          =   195
  69.          Left            =   120
  70.          TabIndex        =   14
  71.          Top             =   1440
  72.          Width           =   1095
  73.       End
  74.       Begin VB.Label Label3 
  75.          Caption         =   "Total Records :"
  76.          BeginProperty Font 
  77.             Name            =   "Verdana"
  78.             Size            =   8.25
  79.             Charset         =   0
  80.             Weight          =   400
  81.             Underline       =   0   'False
  82.             Italic          =   0   'False
  83.             Strikethrough   =   0   'False
  84.          EndProperty
  85.          Height          =   255
  86.          Left            =   120
  87.          TabIndex        =   13
  88.          Top             =   960
  89.          Width           =   1335
  90.       End
  91.       Begin VB.Label Label2 
  92.          Alignment       =   2  'Center
  93.          AutoSize        =   -1  'True
  94.          BeginProperty Font 
  95.             Name            =   "Comic Sans MS"
  96.             Size            =   9.75
  97.             Charset         =   0
  98.             Weight          =   700
  99.             Underline       =   0   'False
  100.             Italic          =   0   'False
  101.             Strikethrough   =   0   'False
  102.          EndProperty
  103.          ForeColor       =   &H00000000&
  104.          Height          =   285
  105.          Left            =   1275
  106.          TabIndex        =   12
  107.          Top             =   360
  108.          Width           =   105
  109.       End
  110.    End
  111.    Begin VB.ComboBox Text1 
  112.       Enabled         =   0   'False
  113.       BeginProperty Font 
  114.          Name            =   "Arial"
  115.          Size            =   8.25
  116.          Charset         =   0
  117.          Weight          =   400
  118.          Underline       =   0   'False
  119.          Italic          =   0   'False
  120.          Strikethrough   =   0   'False
  121.       EndProperty
  122.       Height          =   330
  123.       Left            =   0
  124.       TabIndex        =   10
  125.       Top             =   6960
  126.       Width           =   8895
  127.    End
  128.    Begin VB.Frame Frame3 
  129.       Caption         =   "Information"
  130.       Height          =   975
  131.       Left            =   8880
  132.       TabIndex        =   5
  133.       Top             =   7320
  134.       Width           =   3015
  135.       Begin VB.Label Label1 
  136.          Caption         =   "This Query Viewer Is Jointly Designed By Sibtain, Zaheer Abbas, Aamir Saeed And Imran"
  137.          BeginProperty Font 
  138.             Name            =   "Verdana"
  139.             Size            =   8.25
  140.             Charset         =   0
  141.             Weight          =   400
  142.             Underline       =   0   'False
  143.             Italic          =   0   'False
  144.             Strikethrough   =   0   'False
  145.          EndProperty
  146.          ForeColor       =   &H00000000&
  147.          Height          =   615
  148.          Left            =   120
  149.          TabIndex        =   8
  150.          Top             =   240
  151.          Width           =   2775
  152.       End
  153.    End
  154.    Begin VB.Frame Frame2 
  155.       Caption         =   "Advance Features"
  156.       Height          =   855
  157.       Left            =   0
  158.       TabIndex        =   4
  159.       Top             =   7320
  160.       Width           =   8775
  161.       Begin VB.CommandButton Command4 
  162.          Caption         =   "Change Provider"
  163.          Height          =   375
  164.          Left            =   3240
  165.          TabIndex        =   9
  166.          Top             =   360
  167.          Width           =   1455
  168.       End
  169.       Begin VB.CommandButton Command3 
  170.          Caption         =   "Change Database"
  171.          Enabled         =   0   'False
  172.          Height          =   375
  173.          Left            =   1680
  174.          TabIndex        =   7
  175.          Top             =   360
  176.          Width           =   1455
  177.       End
  178.       Begin VB.CommandButton Command2 
  179.          Caption         =   "Change Server"
  180.          Enabled         =   0   'False
  181.          Height          =   375
  182.          Left            =   120
  183.          TabIndex        =   6
  184.          Top             =   360
  185.          Width           =   1455
  186.       End
  187.    End
  188.    Begin MSHierarchicalFlexGridLib.MSHFlexGrid Grid 
  189.       Height          =   6855
  190.       Left            =   0
  191.       TabIndex        =   3
  192.       Top             =   0
  193.       Width           =   8895
  194.       _ExtentX        =   15690
  195.       _ExtentY        =   12091
  196.       _Version        =   393216
  197.       BackColor       =   15724527
  198.       ForeColor       =   0
  199.       FixedCols       =   0
  200.       GridColor       =   -2147483627
  201.       AllowUserResizing=   3
  202.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  203.          Name            =   "Verdana"
  204.          Size            =   8.25
  205.          Charset         =   0
  206.          Weight          =   400
  207.          Underline       =   0   'False
  208.          Italic          =   0   'False
  209.          Strikethrough   =   0   'False
  210.       EndProperty
  211.       _NumberOfBands  =   1
  212.       _Band(0).Cols   =   2
  213.       _Band(0).GridLineWidthBand=   1
  214.    End
  215.    Begin VB.CommandButton Command1 
  216.       Caption         =   "Run!"
  217.       Enabled         =   0   'False
  218.       Height          =   375
  219.       Left            =   9000
  220.       TabIndex        =   0
  221.       Top             =   6960
  222.       Width           =   1935
  223.    End
  224.    Begin VB.Frame Frame1 
  225.       Caption         =   "Tables List"
  226.       Height          =   4575
  227.       Left            =   9000
  228.       TabIndex        =   1
  229.       Top             =   0
  230.       Width           =   2775
  231.       Begin VB.ListBox List1 
  232.          Enabled         =   0   'False
  233.          BeginProperty Font 
  234.             Name            =   "Arial"
  235.             Size            =   8.25
  236.             Charset         =   0
  237.             Weight          =   700
  238.             Underline       =   0   'False
  239.             Italic          =   0   'False
  240.             Strikethrough   =   0   'False
  241.          EndProperty
  242.          ForeColor       =   &H00FF0000&
  243.          Height          =   4050
  244.          Left            =   120
  245.          TabIndex        =   2
  246.          Top             =   240
  247.          Width           =   2535
  248.       End
  249.    End
  250. Attribute VB_Name = "Form1"
  251. Attribute VB_GlobalNameSpace = False
  252. Attribute VB_Creatable = False
  253. Attribute VB_PredeclaredId = True
  254. Attribute VB_Exposed = False
  255. Public Msg As String
  256. Private Sub Command1_Click()
  257. Text1.AddItem Text1.Text
  258. Msg = "True"
  259. RunQuery
  260. End Sub
  261. Private Sub Command2_Click()
  262. Form2.Show 1
  263. End Sub
  264. Private Sub Command3_Click()
  265. If Provider = "SQL Server" Or Provider = "Oracle" Then
  266.     GetTables
  267. End If
  268. If Provider = "Ms Access 2000" Or Provider = "Ms Access 97" Or Provider = "Foxpro" Then
  269.     Form2.Show 1
  270. End If
  271. End Sub
  272. Private Sub Command4_Click()
  273. Form4.Show 1
  274. End Sub
  275. Private Sub Form_Load()
  276. Form1.Show
  277. Form4.Show 1
  278. End Sub
  279. Private Sub Form_Unload(Cancel As Integer)
  280. If cn.State = 1 Then
  281.     cn.Close
  282. End If
  283. End Sub
  284. Private Sub RunQuery()
  285. On Error Resume Next
  286. Grid.Clear
  287. If Text1.Text = "" Then
  288.     MsgBox "Please Enter Query", vbCritical, "Help!"
  289.     Exit Sub
  290. End If
  291. Dim rs As New Recordset
  292. rs.Open Text1.Text, cn, adOpenKeyset, adLockOptimistic, 1
  293. If Err.Number <> 0 Then
  294.     MsgBox Err.Description
  295.     Exit Sub
  296. End If
  297. Set Grid.DataSource = rs
  298. Label5.Caption = rs.RecordCount
  299. Label6.Caption = rs.Fields.Count
  300. rs.Close
  301. Text1.SelStart = 0
  302. Text1.SelLength = Len(Text1.Text)
  303. If Msg = "True" Then
  304.     If UCase(Left(Text1.Text, 6)) <> "SELECT" Then
  305.         If Provider = "Oracle" Then
  306.             rs.Open "select * from " & List1.Text, cn, adOpenForwardOnly, adLockOptimistic, 1
  307.         Else
  308.             rs.Open "select * from " & "[" & List1.Text & "]", cn, adOpenForwardOnly, adLockOptimistic, 1
  309.         End If
  310.         Set Grid.DataSource = rs
  311.         Msg = "False"
  312.     End If
  313. End If
  314. End Sub
  315. Private Sub List1_Click()
  316. If Provider = "Oracle" Then
  317.     Text1.Text = "Select * from " & List1.Text
  318.     Text1.Text = "Select * from " & "[" & List1.Text & "]"
  319. End If
  320. Label2.Caption = List1.Text
  321. RunQuery
  322. End Sub
  323. Private Sub Text1_KeyPress(KeyAscii As Integer)
  324. If KeyAscii = 13 Then
  325.     Text1.AddItem Text1.Text
  326.     Msg = "True"
  327.     RunQuery
  328. End If
  329. End Sub
  330.